﻿<%@ Page Language="C#" MasterPageFile="~/Hoso/MasterPage_Hoso.master" AutoEventWireup="true" CodeFile="QuanlyPhumuc.aspx.cs" Inherits="Hoso_QuanlyPhumuc" %>
<%@ Register TagPrefix="uc" TagName="Menu" Src="~/Hoso/QuantriMenu.ascx"%>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>


<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <uc:Menu ID="menu" runat="server" />
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">
            function RowDblClick(sender, eventArgs)
            {
              sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
            </script>

        </telerik:RadCodeBlock>
       
       <!-- load ajax-->
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        </telerik:RadAjaxManager>
        <!-- end-->
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
            BackColor="#99FF66" Skin="WebBlue" />
    <asp:Label ID="Label1" runat="server" Text=""></asp:Label>    
    <asp:Label ID="Label2" runat="server" Text=""></asp:Label>
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" Width="650px"
        AllowSorting="True" AutoGenerateColumns="False" CellSpacing="0" 
        AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowAutomaticDeletes="True"
        DataSourceID="SqlDataSource1" GridLines="None" 
        ondatabound="RadGrid1_DataBound" onitemdeleted="RadGrid1_ItemDeleted" 
        oniteminserted="RadGrid1_ItemInserted" 
        onitemupdated="RadGrid1_ItemUpdated" Skin="Office2007" 
        onitemcommand="RadGrid1_ItemCommand" PageSize="5" >
  
         
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>

<MasterTableView AutoGenerateColumns="False" DataKeyNames="maphumuc" 
               DataSourceID="SqlDataSource1" CommandItemDisplay="Top">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>

<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>

    <Columns>
     <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColum" FilterControlAltText="Filter EditCommandColumn column">
                    </telerik:GridEditCommandColumn>
        <telerik:GridBoundColumn DataField="maphumuc" DataType="System.Int32" 
            FilterControlAltText="Filter maphumuc column" HeaderText="Mã phụ mục" 
            ReadOnly="True" SortExpression="maphumuc" UniqueName="maphumuc">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="tenphumuc" 
            FilterControlAltText="Filter tenphumuc column" HeaderText="Tên phụ mục" 
            SortExpression="tenphumuc" UniqueName="tenphumuc">
        </telerik:GridBoundColumn>
        <telerik:GridDropDownColumn DataField="machuyenmuc" DataType="System.Int32" 
          ListTextField="tenchuyenmuc" ListValueField="machuyenmuc"
         ColumnEditorID="GridDropDownColumnEditor1"  DataSourceID="SqlDataSource3"
            FilterControlAltText="Filter machuyenmuc column" HeaderText="Tên chuyên mục" 
            SortExpression="machuyenmuc" UniqueName="machuyenmuc">
         </telerik:GridDropDownColumn>
        <telerik:GridDropDownColumn DataField="matinhtrangpm" DataType="System.Int32" 
          ListTextField="tentinhtrangpm" ListValueField="matinhtrangpm"
         ColumnEditorID="GridDropDownColumnEditor2"  DataSourceID="SqlDataSource2"
            FilterControlAltText="Filter matinhtrangpm column" HeaderText="Tên tình trạng" 
            SortExpression="matinhtrangpm" UniqueName="matinhtrangpm">
        </telerik:GridDropDownColumn>
         <telerik:GridButtonColumn ConfirmText="Delete phụ mục ?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn">
                    </telerik:GridButtonColumn>
    </Columns>

<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
 <ClientSettings EnableRowHoverStyle="true">
               <Selecting AllowRowSelect="True" />
               <ClientEvents OnRowDblClick="RowDblClick" />
           </ClientSettings>
<FilterMenu EnableImageSprites="False"></FilterMenu>
  
         
           </telerik:RadGrid>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConflictDetection="CompareAllValues" 
        ConnectionString="<%$ ConnectionStrings:forumConnectionString %>" 
        DeleteCommand="DELETE FROM [PHUMUC] WHERE [maphumuc] = @original_maphumuc AND [tenphumuc] = @original_tenphumuc AND [machuyenmuc] = @original_machuyenmuc AND [matinhtrangpm] = @original_matinhtrangpm" 
        InsertCommand="INSERT INTO [PHUMUC] ([tenphumuc], [machuyenmuc], [matinhtrangpm]) VALUES (@tenphumuc, @machuyenmuc, @matinhtrangpm)" 
        OldValuesParameterFormatString="original_{0}" 
        SelectCommand="SELECT * FROM [PHUMUC]" 
        UpdateCommand="UPDATE [PHUMUC] SET [tenphumuc] = @tenphumuc, [machuyenmuc] = @machuyenmuc, [matinhtrangpm] = @matinhtrangpm WHERE [maphumuc] = @original_maphumuc AND [tenphumuc] = @original_tenphumuc AND [machuyenmuc] = @original_machuyenmuc AND [matinhtrangpm] = @original_matinhtrangpm">
        <DeleteParameters>
            <asp:Parameter Name="original_maphumuc" Type="Int32" />
            <asp:Parameter Name="original_tenphumuc" Type="String" />
            <asp:Parameter Name="original_machuyenmuc" Type="Int32" />
            <asp:Parameter Name="original_matinhtrangpm" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="tenphumuc" Type="String" />
            <asp:Parameter Name="machuyenmuc" Type="Int32" />
            <asp:Parameter Name="matinhtrangpm" Type="Int32" />
            <asp:Parameter Name="original_maphumuc" Type="Int32" />
            <asp:Parameter Name="original_tenphumuc" Type="String" />
            <asp:Parameter Name="original_machuyenmuc" Type="Int32" />
            <asp:Parameter Name="original_matinhtrangpm" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="tenphumuc" Type="String" />
            <asp:Parameter Name="machuyenmuc" Type="Int32" />
            <asp:Parameter Name="matinhtrangpm" Type="Int32" />
        </InsertParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:forumConnectionString %>" 
        SelectCommand="SELECT [matinhtrangpm], [tentinhtrangpm] FROM [TINHTRANGPM]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:forumConnectionString %>" 
        SelectCommand="SELECT [machuyenmuc], [tenchuyenmuc] FROM [CHUYENMUC]">
    </asp:SqlDataSource>

</asp:Content>
